﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    private static int count = 1;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            Label1.Text = count.ToString();
            if (count > 1)
            {                
                for (int i = 1; i <= count; i++)
                {
                    MyControls_NewQuestion newQuestion = LoadControl("~/MyControls/NewQuestion.ascx") as MyControls_NewQuestion;
                    pnlQuestion.Controls.Add(newQuestion);
                }
            }            
        }

    }

    protected void btnNewQuestion_Click(object sender, EventArgs e)
    {
        MyControls_NewQuestion newQuestion = LoadControl("~/MyControls/NewQuestion.ascx") as MyControls_NewQuestion;
        pnlQuestion.Controls.Add(newQuestion);
        Session.Add(count.ToString(), newQuestion);
        count++;
    }

}